package com.bookmarket.service.impl;

import com.bookmarket.dao.LJClassifyMapper;
import com.bookmarket.entity.Btype;
import com.bookmarket.entity.Stype;
import com.bookmarket.service.IClassifyService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service("/classifyService")
public class ClassifyServiceImpl implements IClassifyService{


        @Resource
        private LJClassifyMapper ljClassifyMapper;

        //增
        public void insertBtype(Btype btype){
            ljClassifyMapper.insertBtype(btype);
        }
        //删
        public void delBtype(int id){
            ljClassifyMapper.delBtype(id);
        }
        //改
        public void updateBtype(Btype btype){
            ljClassifyMapper.updateBtype(btype);
        }
        //查所有
        public List<Btype> selectBtype(){
            List<Btype> list=ljClassifyMapper.selectBtype();
            return list;
        }
        //分页查
        public Page queryB(int pageNum, int pageSize,Btype btype) {
            Page page = PageHelper.startPage(pageNum, pageSize);
            List<Btype> list = ljClassifyMapper.getLike(btype);
            return page;
        }
        /********************************************************************************/
        //增
        public void insertStype(Stype stype){
            ljClassifyMapper.insertStype(stype);
        }
        //根据大类型查对应id
        public Btype selectById(String type){
            Btype btype=ljClassifyMapper.selectById(type);
            return btype;
        }
        //删
        public void delStype(int id){
            ljClassifyMapper.delStype(id);
        }
        //改
        public void updateStype(Stype stype){
            ljClassifyMapper.updateStype(stype);
        }
        //查
        public List<Stype> selectStype(){
            List<Stype> list=ljClassifyMapper.selectStype();
            return list;
        }
        //分页查
        public Page queryS(int pageNum, int pageSize,Stype stype) {
            Page page = PageHelper.startPage(pageNum, pageSize);
            List list = ljClassifyMapper.get(stype);
            return page;
        }












    public LJClassifyMapper getLjClassifyMapper() {
        return ljClassifyMapper;
    }

    public void setLjClassifyMapper(LJClassifyMapper ljClassifyMapper) {
        this.ljClassifyMapper = ljClassifyMapper;
    }
}
